package cn.huaqingcheng.tool.core.model;

import java.util.Iterator;

/**
 * 简单数组迭代器
 *
 * @param <E> 容器内元素
 */
public class ArrayIterator<E> implements Iterator<E> {

    private final E[] items;

    private int index;

    @SafeVarargs
    public ArrayIterator(E... items) {
        this.items = items;
    }

    @Override
    public boolean hasNext() {
        return index < items.length;
    }

    @Override
    public E next() {
        E o = items[index];
        index++;
        return o;
    }

}
